package com.bioscript.standalone.dataStructures;

import java.util.HashMap;
import java.util.Map;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public final class Snp implements Comparable<Snp>{

	public static String tochar = "toChar";
	public static String fromChar = "fromChar" ;
	public static String coverage = "coverage";
	public static String fromPosition = "fromPosition";
	public static String toPosition = "toPosition";
	public static String variants = "variants";
	
	private Range range = null;
	
	public Map<String, String> getPropertyMap()
	{
		return new HashMap<String, String>(map);
	}
	
	public void setMap(Map<String, String> map)
	{
		this.map.putAll(map);
	}

	public Snp(Range range)
	{
		this.range = new Range(range.getLowerLimit(), range.getUpperLimit(), range.getName());
		this.range.setMetadata(range.getMetadata());
	}
	
	public Range getRange()
	{
		Range range = new Range(this.range.getLowerLimit(),this.range.getUpperLimit(),this.range.getName());
		range.setMetadata(this.range.getMetadata());
		return range;
	}
	
	public Element toXML(Document doc) {
		// TODO Auto-generated method stub
		return null;
	}

	private Map<String, String> map = new HashMap<String, String>();

	public void setProperty(String propName, String value)
	{
		map.put(propName, value);
	}
	
	public String getProperty(String prop)
	{
		return map.get(prop);
	}

	@Override
	public int compareTo(Snp o) {
		SimpleRangeComparator comparator = new SimpleRangeComparator();
		return comparator.compare(range, o.getRange());
	}
}
